import {defineStore} from 'pinia'
import {LoginInfo} from '@/type/user'

export default defineStore({
    id: 'UserStore',
    state: (): LoginInfo => ({
        userInfo: {},
        roleList: [],
        routeList: [],
        permissionList: []
    }),
    actions: {
        setAuthorize(loginInfo: LoginInfo) {
            this.userInfo = loginInfo?.userInfo || {}
            this.roleList = loginInfo?.roleList || []
            this.routeList = loginInfo?.routeList || []
            this.permissionList = loginInfo?.permissionList || []
        }
    }
})
